package com.oschina.wed.common.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class SpringUtil implements ApplicationContextAware {

	private static ApplicationContext ctx ;

	/**
	 * @param applicationContext
	 * @throws BeansException
	 * @see ApplicationContextAware#setApplicationContext(ApplicationContext)
	 */
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		ctx = applicationContext ;
	}

	/**
	 *
	 * @param name
	 * @return
	 */
	public static Object getBean(String name) {
		return ctx.getBean(name) ;
	}



}
